#include<functional>#include<gazebo/gazebo.hh>#include<gazebo/physics/physics.hh>#include<gazebo/common/common.hh>#include<ignition/math/Vector3.hh>namespacegazebo{classJointControllerPlugin:publicModelPlugin{public:voidLoad(physics::ModelPtr_parent,sdf::ElementPtr/*_sdf*/){// Store the pointer to the modelthis->model=_parent;this->updateConnection=event::Events::ConnectWorldUpdateBegin(std::bind(&JointControllerPlugin::OnUpdate,this));}// Called by the world update start eventpublic:voidOnUpdate(){this->model->GetJoint("joint_1")->SetVelocity(0,2.0);}// Pointer to the modelprivate:physics::ModelPtrmodel;// Pointer to the update event connectionprivate:event::ConnectionPtrupdateConnection;};// Register this plugin with the simulatorGZ_REGISTER_MODEL_PLUGIN(JointControllerPlugin)}